<template>
  <div class="orderManage">
    <split-pane split="horizontal" :default-percent="60" v-on:resize="resize">
      <!-- 国际运输委托单管理 -->
      <template slot="paneL">
        <div class="top" ref="topType">
          <div class="form">
            <el-form ref="form" :model="form" :rules="rule" :inline="true" size="mini">
              <el-form-item prop="orderNum" label="订单号:">
                <el-input v-model="form.orderNum" style="width:170px" clearable></el-input>
              </el-form-item>
              <el-form-item prop="contractNo" label="合同号:">
                <el-input v-model="form.contractNo" style="width:170px" clearable></el-input>
              </el-form-item>
              <el-form-item prop="orderStatue" label="订单状态:">
                <el-select v-model="form.orderStatue" clearable style="width:170px">
                  <el-option v-for="(item, index) in statusList" :key="index" :value="item.rvLowValue" :label="item.rvCmeaning"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item prop="start" label="下单时间:">
                <el-date-picker style="width:170px" v-model="form.start" value-format="yyyy-MM-dd"></el-date-picker>
              </el-form-item>
              <el-form-item prop="end" label-width="3em" label="——">
                <el-date-picker style="width:170px" v-model="form.end" value-format="yyyy-MM-dd"></el-date-picker>
              </el-form-item>
              <el-form-item prop label>
                <el-button type="primary" size="mini" @click="searchList">查 询</el-button>
              </el-form-item>
            </el-form>
          </div>
          <div class="btn-area" ref="btnArea">
            <el-row :gutter="24">
              <el-col :span="12">
                <buttonName @clickEvent="clickEventDom"></buttonName>
                <!--                <el-button @click="applyShut" plain size="mini" type="primary" v-if="isAuth('applyShut')">申请关闭</el-button>-->
                <!--                <el-button @click="shutAudit" plain size="mini" type="primary" v-if="isAuth('shutAudit')">订单运单管理</el-button>-->
              </el-col>
            </el-row>
          </div>
          <div class="name">订单信息列表</div>
          <el-table
            :data="tableData"
            border
            class="orderShutData"
            @row-click="rowClick"
            :height="typeHeight"
            :header-cell-style="{ textAlign: 'center' }"
            highlight-current-row
            @row-dblclick="dbrowClick"
          >
            <el-table-column :index="indexMethod" type="index" align="center" label="序号" width="50"></el-table-column>
            <el-table-column align="center" prop="attApplyStatusvalue" label="订单关闭申请状态" show-overflow-tooltip width="160"></el-table-column>
            <el-table-column align="left" prop="cmtContractNo" label="合同号" show-overflow-tooltip width="180"></el-table-column>
            <el-table-column align="left" show-overflow-tooltip label="合同名称" width="180" prop="cmtContractName">
              <template slot-scope="scope">
                <span>{{ contractsCorrespondence[scope.row.cmtContractNo] }}</span>
              </template>
            </el-table-column>
            <el-table-column align="left" label="订单号" prop="attCode" show-overflow-tooltip width="180">
              <template slot-scope="scope">
                <u @click="getOrderDynamics(scope.row.attCode)">{{ scope.row.attCode }}</u>
              </template>
            </el-table-column>
            <el-table-column align="center" label="订单状态" prop="attStatusName" show-overflow-tooltip width="180"></el-table-column>
            <el-table-column align="center" label="下单时间" prop="attCreatetime" show-overflow-tooltip width="180"></el-table-column>
            <el-table-column align="left" label="客户名称" prop="adcConsigner" show-overflow-tooltip width="160"></el-table-column>
            <el-table-column align="left" label="联系人" prop="adcLinkperson" show-overflow-tooltip width="160"></el-table-column>
            <el-table-column align="left" label="联系电话" prop="adcLinkphone" show-overflow-tooltip width="160"></el-table-column>
            <el-table-column align="left" label="起始地" prop="adcSAddress" show-overflow-tooltip width="200"></el-table-column>
            <el-table-column align="left" label="目的地" prop="adcDAddress" show-overflow-tooltip width="200"></el-table-column>
            <el-table-column align="left" prop="gdsNames" label="货物名称" show-overflow-tooltip width="160"></el-table-column>
            <el-table-column align="left" label="已派车量" prop="dispatchedWeight" show-overflow-tooltip></el-table-column>
            <el-table-column align="left" label="未派车量" prop="gdsSurplusWeight" show-overflow-tooltip></el-table-column>
            <el-table-column align="right" label="订单总质量(T)" prop="gdsWeight" show-overflow-tooltip width="160"></el-table-column>
            <el-table-column align="right" label="订单金额(RMB)" prop="rmbamount" show-overflow-tooltip width="160"></el-table-column>
            <el-table-column align="left" label="操作人" prop="attLstmodifier" show-overflow-tooltip width="160"></el-table-column>
            <el-table-column align="center" label="操作时间" prop="attLstmodifytime" show-overflow-tooltip width="180"></el-table-column>
            <el-table-column align="left" prop="attRemark" label="备注" show-overflow-tooltip width="180"></el-table-column>
          </el-table>
          <div>
            <el-pagination
              class="pagination"
              small
              background
              ref="pagination"
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page="Pagination.currentPage"
              :page-sizes="Pagination.pageSizeList"
              :page-size="Pagination.pageSize"
              :layout="Pagination.layout"
              :total="Pagination.total"
            ></el-pagination>
          </div>

          <!--    </div>-->
        </div>
      </template>

      <template slot="paneR">
        <div class="bottom" ref="bottomCode">
          <el-form ref="form" :model="belowform" :inline="true" size="mini">
            <el-form-item prop="orderStatue" label="运单状态:">
              <el-select v-model="belowform.WaybillStatue" clearable style="width:170px">
                <el-option v-for="(item, index) in WaybillStatueList" :key="index" :value="item.rvLowValue" :label="item.rvCmeaning"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item prop label>
              <el-button type="primary" size="mini" @click="searchListBystatus">查 询</el-button>
            </el-form-item>
          </el-form>
          <div class="name">运单信息列表</div>
          <div class="btn-area" ref="detlArea">
            <el-button plain size="mini" type="primary" @click="auditOrders">审核</el-button>
            <el-button plain size="mini" type="primary" @click="exportWayInfo">导出</el-button>
          </div>
          <el-table
            :data="topTableData"
            border
            :height="detlHeight"
            :header-cell-style="{ textAlign: 'center' }"
            highlight-current-row
            @row-click="getTopCurrent"
            @select="wayTableSelect"
            @select-all="wayTableSelect"
            @selection-change="wayTableSelectChangeHanlder"
          >
            <el-table-column type="index" align="center" label="序号" width="50"></el-table-column>
            <el-table-column type="selection" align="center" :fixed="true" :selectable="wayTableSelectable"></el-table-column>
            <el-table-column prop="attCode" label="订单号" width="200" show-overflow-tooltip sortable></el-table-column>
            <el-table-column label="运单号" prop="wabCode" show-overflow-tooltip sortable width="200">
              <template slot-scope="scope">
                <u @click="getWaybillDynamics(scope.row.wabCode)">{{ scope.row.wabCode }}</u>
              </template>
            </el-table-column>
            <el-table-column label="车牌号" prop="trkNo" show-overflow-tooltip width="110"></el-table-column>
            <el-table-column label="司机" prop="dvrName" show-overflow-tooltip></el-table-column>
            <el-table-column align="left" label="司机电话" prop="dvrCtctel" show-overflow-tooltip width="150"></el-table-column>
            <!--            <el-table-column prop="wabStatus" label="运单状态" width="110" align="center" show-overflow-tooltip  ></el-table-column>-->
            <el-table-column align="center" label="运单状态" prop="wabStatusName" show-overflow-tooltip width="110"></el-table-column>
            <el-table-column label="货物名称" prop="wabGoodname" show-overflow-tooltip width="110"></el-table-column>
            <el-table-column align="right" label="货物重量(T)" prop="wabWeight" show-overflow-tooltip width="130"></el-table-column>
            <!--            <el-table-column prop="WAB_ETC" label="ETC费用" width="110" align="right" show-overflow-tooltip  ></el-table-column>-->
            <!--            <el-table-column prop="WAB_OILCONS" label="油耗费用" width="110" align="right" show-overflow-tooltip  ></el-table-column>-->
            <!--            <el-table-column prop="WAB_POERF" label="运费" align="right" show-overflow-tooltip  ></el-table-column>-->
            <!--            <el-table-column prop="RESUL" label="总和" align="right" show-overflow-tooltip  ></el-table-column>-->
            <el-table-column align="center" label="装货时间" prop="wcdSttime" show-overflow-tooltip width="110"></el-table-column>
            <el-table-column align="center" label="卸货时间" prop="wcdEdtime" show-overflow-tooltip width="110"></el-table-column>
            <!--            <el-table-column prop="tayOprtdate" label="轨迹跟踪" width="110" show-overflow-tooltip  ></el-table-column>-->
            <!--            <el-table-column prop="auditStatus" label="审核标识" width="110" show-overflow-tooltip  ></el-table-column>-->
            <!--            <el-table-column prop="tayOprtdate" label="审核操作人" width="120" show-overflow-tooltip  ></el-table-column>-->
            <!--            <el-table-column prop="tayOprtdate" label="审核操作时间" width="130" align="center" show-overflow-tooltip  ></el-table-column>-->
            <el-table-column label="备注" prop="tayOprtdate" show-overflow-tooltip></el-table-column>
          </el-table>
        </div>
      </template>
    </split-pane>

    <!-- //订单动态弹出框 -->
    <el-dialog
      :title="name"
      width="80%"
      :visible.sync="openDialogA"
      v-if="openDialogA"
      v-el-drag-dialog
      close-on-press-escape="false"
      :before-close="close"
      :close-on-click-modal="false"
    >
      <div class="orderDynamic" ref="bottomCode">
        <div class="name">订单动态信息</div>
        <el-table :data="dynamicData" border :height="detlHeight" :header-cell-style="{ textAlign: 'center' }" highlight-current-row>
          <el-table-column type="index" align="center" label=" " width="50"></el-table-column>
          <el-table-column align="center" prop="optType" label="操作类型" show-overflow-tooltip width></el-table-column>
          <el-table-column align="center" prop="optStatusName" label="操作状态" show-overflow-tooltip width></el-table-column>
          <el-table-column align="center" prop="optCreator" label="操作人" show-overflow-tooltip width></el-table-column>
          <el-table-column align="center" prop="optCreatetime" label="操作时间" show-overflow-tooltip width></el-table-column>
          <!--          <el-table-column align="left" prop="optChanger" label="最后修改人" show-overflow-tooltip width=""></el-table-column>-->
          <!--          <el-table-column align="center" prop="optChangetime" label="最后修改时间" show-overflow-tooltip-->
          <!--                           width=""></el-table-column>-->
          <!--          <el-table-column align="left" prop="optRemark" label="备注" show-overflow-tooltip width=""></el-table-column>-->
        </el-table>
      </div>
    </el-dialog>
    <el-dialog
      :title="name"
      width="80%"
      :visible.sync="openDialogB"
      v-if="openDialogB"
      v-el-drag-dialog
      close-on-press-escape="false"
      :before-close="close"
      :close-on-click-modal="false"
    >
      <div class="botTable">
        <div class="botTableTitle">运单状态</div>
        <div class="botTableBox">
          <el-table :data="botTableData" border :height="detlHeight" :header-cell-style="{ textAlign: 'center' }" highlight-current-row>
            <el-table-column type="index" align="center" label=" " width="50"></el-table-column>
            <el-table-column align="center" label="操作状态" prop="tayNo" show-overflow-tooltip></el-table-column>
            <el-table-column label="司机" prop="tayIeflag" show-overflow-tooltip></el-table-column>
            <el-table-column label="车牌号" prop="tayStates" show-overflow-tooltip></el-table-column>
            <el-table-column label="操作人" prop="tdrName" show-overflow-tooltip></el-table-column>
            <el-table-column align="center" label="操作时间" prop="tayWrkdate" show-overflow-tooltip></el-table-column>
            <el-table-column label="备注" prop="tdrRmark" show-overflow-tooltip></el-table-column>
          </el-table>
        </div>
      </div>
    </el-dialog>

    <!-- 新增修改订单 对话框 -->
    <el-dialog
      :title="name"
      width="80%"
      :visible.sync="openDialog"
      v-if="openDialog"
      v-el-drag-dialog
      close-on-press-escape="false"
      :before-close="close"
      :close-on-click-modal="false"
    >
      <div class="content">
        <div class="box">
          <div class="name">合同信息</div>
          <el-form :model="basicForm" :rules="basicRule" size="mini" ref="basicForm" label-width="auto">
            <!--            <el-row>-->
            <!--                <el-form-item label="合同名称：" prop="cmtContractNo">-->
            <!--                  <el-select clearable v-model="basicForm.cmtContractNo" :disabled="edit || see" style="width:100%"-->
            <!--                             @change="getDealInfo"  filterable  allow-create>-->
            <!--                    <el-option v-for="(item,index) in edit || see ? contracts : dealInfos" :key="index" :value="item.cmtContractNo"-->
            <!--                               :label="item.cmtContractName"></el-option>-->
            <!--                  </el-select>-->
            <!--                </el-form-item>-->
            <!--            </el-row>-->
            <el-row>
              <el-form-item label="合同名称：" prop="cmtContractName">
                <el-input
                  v-model="basicForm.cmtContractName"
                  :disabled="edit || see"
                  style="width:100%"
                  @focus="findContract"
                  clearable
                  placeholder="请选择合同名称"
                  label="合同名称"
                >
                  <i slot="suffix" class="el-input__icon el-icon-arrow-down" @click="findContract"></i>
                </el-input>
              </el-form-item>
            </el-row>
          </el-form>
        </div>
        <div class="box">
          <div class="name">基础信息</div>
          <el-form :model="basicForm" :rules="basicRule" size="mini" ref="basicForm" label-width="auto">
            <el-row>
              <el-col :span="8">
                <!--                糖厂、货主作为客户-->
                <el-form-item label="客户：" prop="attCltId ? attCltId : attCltName">
                  <el-select
                    :disabled="check || see"
                    @change="getName"
                    allow-create
                    clearable
                    filterable
                    style="width:100%"
                    v-model="basicForm.attCltId ? basicForm.attCltId : basicForm.attCltName"
                  >
                    <el-option v-for="(item, index) in customer" :key="index" :value="item.cltId ? item.cltId : item.cltName" :label="item.cltName"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>

              <el-col :span="8">
                <el-form-item label="委托人：" prop="adcConsigner">
                  <el-input clearable v-model="basicForm.adcConsigner" :disabled="check || see" maxlength="32"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="联系人：" prop="adcLinkperson">
                  <el-input clearable v-model="basicForm.adcLinkperson" :disabled="check || see" maxlength="32"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="联系电话：" prop="adcLinkphone">
                  <el-input clearable v-model="basicForm.adcLinkphone" :disabled="check || see" maxlength="16"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="手机：" prop="adcTel">
                  <el-input clearable v-model="basicForm.adcTel" :disabled="check || see" maxlength="11"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="Email：" prop="adcEmail">
                  <el-input clearable v-model="basicForm.adcEmail" :disabled="check || see" maxlength="32"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="QQ：" prop="adcQq">
                  <el-input clearable v-model="basicForm.adcQq" :disabled="check || see" maxlength="32"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="微信：" prop="adcWechat">
                  <el-input clearable v-model="basicForm.adcWechat" :disabled="check || see" maxlength="32"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8">
                <el-form-item label="客户要求作业时间：" prop="attWrkdate">
                  <el-date-picker
                    clearable
                    :picker-options="startPickerOptions"
                    v-model="basicForm.attWrkdate"
                    value-format="yyyy-MM-dd"
                    :disabled="check || see"
                  ></el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="客户要求作业完成时间：" prop="attFinwrkdate">
                  <el-date-picker
                    clearable
                    :picker-options="endPickerOptions"
                    v-model="basicForm.attFinwrkdate"
                    value-format="yyyy-MM-dd"
                    :disabled="check || see"
                  ></el-date-picker>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="车型要求：" prop="adcVehicleRequirements">
                  <el-select clearable v-model="basicForm.adcVehicleRequirements" :disabled="check || see" style="width:100%">
                    <el-option v-for="(item, index) in carType" :key="index" :label="item.rvCmeaning" :value="item.rvLowValue"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <!--              <el-col :span="8">-->
              <!--                <el-form-item label="卸车费支付方：" prop="adcXcfzff">-->
              <!--                  <el-select clearable v-model="basicForm.adcXcfzff" :disabled="check || see" style="width:100%">-->
              <!--                    <el-option v-for="(item,index) in payer" :key="index" :label="item.rvCmeaning"-->
              <!--                               :value="item.rvLowValue"></el-option>-->
              <!--                  </el-select>-->
              <!--                </el-form-item>-->
              <!--              </el-col>-->
              <el-col :span="8">
                <el-form-item label="订单结算方式：" prop="adcJsfhValue">
                  <el-select clearable v-model="basicForm.adcJsfh" style="width:48%" :disabled="check || see" @change="getPay">
                    <el-option v-for="(item, index) in payWay" :key="index" :label="item.rvCmeaning" :value="item.rvLowValue"></el-option>
                  </el-select>
                  <el-select clearable v-model="basicForm.adcJsfhValue" style="width:48%;margin-left: 4%;" :disabled="check || see">
                    <el-option v-for="(item, index) in payTime" :key="index" :label="item.rvCmeaning" :value="item.rvLowValue"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="车长要求：" prop="trkLong">
                  <el-select clearable v-model="basicForm.trkLong" :disabled="check || see" style="width:100%">
                    <el-option v-for="(item, index) in carLong" :key="index" :label="item.rvCmeaning" :value="item.rvLowValue"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
          </el-form>
        </div>
        <div class="concate">
          <div class="send box">
            <div class="name">发货方信息</div>
            <concate-form :cltId="basicForm.attCltId" :compForm="sendForm" :desc="true" :view="view" ref="sendForm"></concate-form>
          </div>
          <div class="box accept">
            <div class="name">收货方信息</div>
            <concate-form :cltId="basicForm.attCltId" :compForm="acceptForm" :desc="false" :view="view" ref="acceptForm"></concate-form>
          </div>
        </div>
        <div class="box">
          <div class="name">获取里程</div>
          <el-form :model="distanceForm" :rules="distanceRule" size="mini" ref="distanceForm" label-width="auto">
            <el-row>
              <el-col :span="8">
                <el-form-item label="里程：" prop="adcDistanced">
                  <el-input clearable v-model="distanceForm.adcDistanced" :disabled="check || see"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="时间：" prop="adcDistancedtime">
                  <el-input clearable v-model="distanceForm.adcDistancedtime" :disabled="check || see"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="2">
                <el-link type="primary" @click="getJourney" :underline="false" v-if="!check && !see">获取里程</el-link>
              </el-col>
            </el-row>
          </el-form>
        </div>
        <div class="box">
          <div class="name">货物信息</div>
          <el-form :model="basicForm" size="mini" :rules="goodsRule" ref="basicForm">
            <el-table :data="basicForm.goodsForm" border height="150px" :header-cell-style="{ textAlign: 'center' }" highlight-current-row>
              <el-table-column type="index" align="center" label="序号" width="50"></el-table-column>
              <el-table-column align="left" label="提货单编号" show-overflow-tooltip width>
                <template slot-scope="scope">
                  <el-form-item :prop="'goodsForm.' + scope.$index + '.gdsBillno'" :rules="goodsRule.cddTakeNo">
                    <el-input clearable v-model="scope.row.gdsBillno" :disabled="check || see"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
              <!--              <el-table-column align="center"  label="品牌" show-overflow-tooltip width="">-->
              <!--                <template slot-scope="scope">-->
              <!--                  <el-form-item :prop="'goodsForm.'+scope.$index+'.gdsType'" :rules="goodsRule.gdsType">-->
              <!--                    <el-select clearable style="width: 100%;" v-model="scope.row.gdsType" :disabled="check || see">-->
              <!--                      <el-option v-for="(item,index) in goods"-->
              <!--                                 :key="index"-->
              <!--                                 :value="item.rvLowValue"-->
              <!--                                 :label="item.rvCmeaning"></el-option>-->
              <!--                    </el-select>-->
              <!--                  </el-form-item>-->
              <!--                </template>-->
              <!--              </el-table-column>-->
              <el-table-column align="left" label="品牌" show-overflow-tooltip width>
                <template slot-scope="scope">
                  <el-form-item :prop="'goodsForm.' + scope.$index + '.gdsType'" :rules="goodsRule.gdsType">
                    <el-input clearable v-model="scope.row.gdsType" :disabled="check || see"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column align="left" label="货名" show-overflow-tooltip width>
                <template slot-scope="scope">
                  <el-form-item :prop="'goodsForm.' + scope.$index + '.gdsName'" :rules="goodsRule.gdsName">
                    <el-input clearable v-model="scope.row.gdsName" :disabled="check || see"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column align="left" label="件数" show-overflow-tooltip width="140">
                <template slot-scope="scope">
                  <el-form-item :prop="'goodsForm.' + scope.$index + '.gdsQuantity'">
                    <el-input clearable v-model="scope.row.gdsQuantity" :disabled="check || see"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column align="left" label="数量(吨)" show-overflow-tooltip width>
                <template slot-scope="scope">
                  <el-form-item :prop="'goodsForm.' + scope.$index + '.gdsWeight'" :rules="goodsRule.gdsWeight">
                    <el-input clearable v-model="scope.row.gdsWeight" :disabled="check || see"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column align="left" label="体积(m³)" show-overflow-tooltip width>
                <template slot-scope="scope">
                  <el-form-item :prop="'goodsForm.' + scope.$index + '.gdsVolumn'">
                    <el-input clearable v-model="scope.row.gdsVolumn" :disabled="check || see"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column align="left" label="运输单价(柜/元)" show-overflow-tooltip width>
                <template slot-scope="scope">
                  <el-form-item :prop="'goodsForm.' + scope.$index + '.gdsPrice'" :rules="goodsRule.gdsPrice">
                    <el-input clearable v-model="scope.row.gdsPrice" :disabled="check || see"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column align="left" label="备注" show-overflow-tooltip width="0">
                <template slot-scope="scope">
                  <el-form-item :prop="'goodsForm.' + scope.$index + '.gdsRemark'">
                    <el-input clearable v-model="scope.row.gdsRemark" :disabled="check || see || see"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
            </el-table>
          </el-form>
        </div>
        <!--        <div class="box" v-if="check">-->
        <!--          <div class="name">发布信息</div>-->
        <!--          <el-form :model="auditForm" :rules="auditRule" size="mini" ref="auditForm" label-width="auto">-->
        <!--            <el-row>-->
        <!--              <el-col :span="20">-->
        <!--                <el-form-item label="发布内容：" prop="attAuditdiffering">-->
        <!--                  <el-input clearable v-model="auditForm.attAuditdiffering" type="textarea" :rows="2"></el-input>-->
        <!--                </el-form-item>-->
        <!--              </el-col>-->
        <!--            </el-row>-->
        <!--          </el-form>-->
        <!--        </div>-->
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="close" size="mini">关闭</el-button>
        <el-button type="primary" @click="save" v-if="!see" size="mini">保存</el-button>
        <!--        <el-button type="primary" @click="rejectAction" v-if="check" size="mini">拒绝</el-button>-->
        <el-button type="primary" @click="auditAction" v-if="check" size="mini">发布</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import paginationMixin from '@/mixins/pagination'
import resizeMixin from '@/mixins/resize'
import concateForm from './concate'
import isAuth from '@/mixins/buttonAuth'
import { auditOrder, auditWayBill, cancleOrderInfo, getRefCodesByType, getWillBillStatus, orderOperaInfo } from '@/request/api'
import { PATTERN } from '@/utils/rules'
import { getSugarUserList } from '@/request/dropDown'
import { addOrderPlanInfo, EditOrderPlanInfo, getContractAll, getWillBillListByAttCode } from '@/request/orderSupervise/orderPlan'
import { auditshutOrderSer, shutOrderSer, sugarOrderInfo } from '@/request/orderManage/orderClose'
import scrollChange from '@/utils/onscroll'
import buttonName from '@/components/buttonName/button-name'
import { export_json_to_excel } from '@/vendor/Export2Excel'

export default {
  name: 'router.orderShut',
  mixins: [paginationMixin, resizeMixin, isAuth],
  components: {
    concateForm,
    buttonName
  },
  data() {
    return {
      selectDataList: [],
      belowform: {
        WaybillStatue: ''
      },
      form: {
        orderNum: '',
        contractNo:'',
        orderStatue: '',
        start: '',
        end: ''
      },
      rule: {
        orderNum: [],
        orderStatue: [],
        start: []
      },
      WaybillStatueList: [], //运单状态信息
      statusList: [], //状态值
      maxHeight: -1,
      typeHeight: -1, //上方表格高度
      detlHeight: -1, //下方表格高度
      tableData: [],
      dynamicData: [], //动态数据
      topTableData: [], //运单信息列表数据
      currentData: {}, //单击选中数据
      viewData: {}, //双击选中数据
      botTableData: [], // 运单动态弹出框 表格数据
      topCurrentData: [],
      //对话框----新增修改
      name: '',
      openDialog: false,
      openDialogA: false,
      openDialogB: false,
      edit: false, //编辑
      see: false, //查看
      check: false, //审核
      dialogTableVisible: false, //合同下拉对话框标志
      view: '0',
      distanceForm: {}, //里程信息
      distanceRule: {
        adcDistanced: [{ required: true, message: '请输入里程', trigger: 'blur' }],
        adcDistancedtime: [{ required: true, message: '请输入时间', trigger: 'blur' }]
      },
      basicForm: {}, //基础信息
      basicRule: {
        attCltId: [{ required: true, message: '请选择客户名称', trigger: 'change' }],
        adcConsigner: [{ required: true, message: '请输入委托人', trigger: 'blur' }],
        adcLinkperson: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
        adcLinkphone: [{ required: true, message: '请输入联系电话', trigger: 'blur' }],
        adcTel: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
        adcEmail: [
          { required: true, message: '请输入Email地址', trigger: 'blur' },
          { pattern: PATTERN.EMAIL, message: '请输入正确的Email地址', trigger: 'blur' }
        ],
        adcQq: [{ required: false, message: '请输入QQ', trigger: 'blur' }],
        adcWechat: [{ required: false, message: '请输入微信', trigger: 'blur' }],
        attWrkdate: [{ required: true, message: '请输入客户要求作业时间', trigger: 'blur' }],
        attFinwrkdate: [{ required: true, message: '请输入客户要求作业完成时间', trigger: 'blur' }],
        adcVehicleRequirements: [{ required: true, message: '请输入车型要求', trigger: 'blur' }],
        adcXcfzff: [{ required: true, message: '请输入卸车支付方', trigger: 'blur' }],
        adcJsfhValue: [{ required: true, message: '请输入订单结算方式', trigger: 'change' }],
        trkLong: [{ required: true, message: '请输入车长要求', trigger: 'blur' }]
      },
      contracts: [], //所有合同信息
      contractsCorrespondence: [], //合同对应信息，合同号对应合同名
      dealInfos: [], //合同下拉数据
      customer: [], //客户
      carType: [], //车型
      payer: [], //卸车支付
      payWay: [], //结算方式
      payTime: [], //结算方式
      carLong: [], //车长
      goods: [],
      selectList: [],
      sendForm: {}, //发货信息
      acceptForm: {}, //收货信息
      concateRule: {},
      goodsForm: [], //货物信息
      goodsRule: {
        cddTakeNo: [{ required: true, message: '请输入提货单编号', trigger: 'blur' }],
        gdsType: [{ required: true, message: '请输入货物品牌', trigger: 'blur' }],
        gdsName: [{ required: true, message: '请输入货物名称', trigger: 'blur' }],
        gdsQuantity: [{ required: true, message: '请输入货物件数', trigger: 'blur' }],
        gdsWeight: [{ required: true, message: '请输入货物质量', trigger: 'blur' }],
        gdsVolumn: [{ required: true, message: '请输入货物体积', trigger: 'blur' }],
        gdsPrice: [{ required: true, message: '请输入货物价格', trigger: 'blur' }]
      },
      //审核信息
      auditForm: { attAuditdiffering: '' },
      auditRule: {},
      exportExcelHeaderName: ['订单号', '运单号', '车牌号', '司机', '司机电话', '运单状态', '货物名称', '货物重量(T)', '装货时间', '卸货时间', '备注 '],
      exportExcelHeader: [
        'attCode',
        'wabCode',
        'trkNo',
        'dvrName',
        'dvrCtctel',
        'wabStatusName',
        'wabGoodname',
        'wabWeight',
        'wcdSttime',
        'wcdEdtime',
        'tayOprtdate'
      ]
    }
  },
  mounted() {
    this.refreshList()
    getRefCodesByType('网络平台运单状态').then(res => {
      if (res.success === '1') {
        this.WaybillStatueList = res.data
      }
    })
    //订单状态
    getRefCodesByType('网络平台订单状态').then(res => {
      if (res.success === '1') {
        this.statusList = res.data
      }
    })
    getRefCodesByType('网络平台货物类型').then(res => {
      if (res.success === '1') {
        this.goods = res.data
      }
    })
    getRefCodesByType('卸车费用付方').then(res => {
      if (res.success === '1') {
        this.payer = res.data
      }
    })
    getRefCodesByType('车型_网络').then(res => {
      if (res.success === '1') {
        this.carType = res.data
      }
    })
    getRefCodesByType('车长_网络').then(res => {
      if (res.success === '1') {
        this.carLong = res.data
      }
    })
    getRefCodesByType('网络_结算方式').then(res => {
      if (res.success === '1') {
        this.payWay = res.data
      }
    })
    //客户下拉框
    getSugarUserList().then(res => {
      if (res.success === '1') {
        this.customer = res.data
      }
    })
    let demandWrapper = document.querySelector('.orderShutData .el-table__body-wrapper')
    // 新增滚动条监听事件
    scrollChange(demandWrapper)
  },
  created() {
    getContractAll().then(res => {
      this.contracts = res.data
      this.contracts.forEach(item => this.$set(this.contractsCorrespondence, item.cmtContractNo, item.cmtContractName))
    })
    // this.resize = () => {
    //   this.maxHeight = this.$refs.inner.offsetHeight
    // }
    this.resize = () => {
      this.typeHeight = this.$refs.topType.offsetHeight - 140
      this.detlHeight = this.$refs.bottomCode.offsetHeight - 10
    }
  },
  computed: {},
  watch: {
    basicForm: {
      handler() {
        this.getPay(this.basicForm.adcJsfh)
      }
    }
  },
  methods: {
    searchListBystatus() {
      if (Object.keys(this.currentData).length == 0) {
        this.$alert('请选择需要查看的订单！', '提示', {
          confirmButtonText: '确定'
        })
        return
      }
      getWillBillListByAttCode({
        orderCode: this.currentData.attCode,
        isPlatform: 'Y',
        billStatus: this.belowform.WaybillStatue
      }).then(res => {
        this.topTableData = res.data
      })
    },
    wayTableSelect(val) {
      if (val.length != 0) {
        this.selectList.length = 0
        val.forEach(v => {
          if (v.wabStatus == 'DSH') {
            this.selectList.push(v)
            console.log(this.selectList)
          }
        })
      }
    },
    //申请关闭 applyShut currentData
    clickEventDom(item) {
      if (item.mdlCode === 'applyShut') {
        this.applyShut()
      } else if (item.mdlCode === 'shutAudit') {
        this.shutAudit()
      }
    },
    applyShut() {
      if (Object.keys(this.currentData).length == 0) {
        this.$alert('请选择需要申请关闭的订单！', '提示', {
          confirmButtonText: '确定'
        })
        return
      }
      if (this.currentData.attStatus == 'DDWC') {
        this.$alert('该订单已完成，不可关闭！', '提示', {
          confirmButtonText: '确定'
        })
        return
      }
      if (this.currentData.attStatus == 'QBPC') {
        this.$alert('该订单已全部派车，不可关闭！', '提示', {
          confirmButtonText: '确定'
        })
        return
      }
      if (this.currentData.attStatus == 'DDGB') {
        this.$alert('该订单已关闭，不可重复关闭！', '提示', {
          confirmButtonText: '确定'
        })
        return
      }
      if (this.currentData.attApplyStatus == '1') {
        this.$alert('该订单已经提交关闭申请，不可重复提交申请！', '提示', {
          confirmButtonText: '确定'
        })
        return
      }
      this.$confirm('您确认要提前关闭此订单吗?', '提示', {
        closeOnClickModal: false
      }).then(() => {
        shutOrderSer({
          uuid: this.currentData.uuid,
          attCode: this.currentData.attCode
        }).then(() => {
          this.refreshList()
        })
        this.$message({
          message: '关闭订单申请已提交！',
          type: 'success',
          showClose: true
        })
      })
    },
    shutAudit() {
      if (this.currentData.attApplyStatus != '1') {
        this.$alert('该订单未提交关闭申请，无法审核！', '提示', {
          confirmButtonText: '确定'
        })
        return
      }
      this.$confirm('是否确认审核?', '提示', {
        closeOnClickModal: false
      }).then(() => {
        auditshutOrderSer({
          uuid: this.currentData.uuid,
          attCode: this.currentData.attCode
        }).then(() => {
          this.refreshList()
        })
        this.$message({
          message: '审核成功！',
          type: 'success',
          showClose: true
        })
      })
    },

    //点击订单号弹出订单动态信息
    getOrderDynamics(attCode) {
      setTimeout(() => {
        this.getDynamic()
      }, 300)
      this.openDialogA = true
    },
    // 获取下方运单信息  当前行数据
    getTopCurrent(row) {
      this.topCurrentData = row
    },
    //点击运单号弹出运单动态信息
    getWaybillDynamics() {
      getWillBillStatus({
        wabUuid: this.topCurrentData.uuid
      }).then(res => {
        this.botTableData = res.data.map(item => {
          return {
            tayNo: item.optStatus,
            tdrName: item.optCreator,
            tayWrkdate: item.optCreatetime,
            tdrRmark: item.optRemark,
            tayIeflag: this.topCurrentData.dvrName,
            tayStates: this.topCurrentData.trkNo
          }
        })
      })

      this.openDialogB = true
    },
    //获取结算类型
    getPay(name) {
      // this.basicForm.adcJsfhValue=''
      this.payTime = []
      getRefCodesByType(name).then(res => {
        if (res.success === '1') {
          this.payTime = res.data
        }
      })
    },
    //查询
    searchList() {
      this.refreshList()
    },
    //重写getList
    getList(currentPage, pageSize, updateTotal) {
      sugarOrderInfo({
        attCode: this.form.orderNum,
        cmtContractNo:this.form.contractNo,
        attStatus: this.form.orderStatue,
        attCreatetimeStart: this.form.start,
        attCreatetimeEnd: this.form.end,
        PageIndex: this.Pagination.currentPage,
        PageSize: this.Pagination.pageSize,
        source: localStorage.getItem('IS_SHOW1') == 2 ? '3' : ''
      }).then(response => {
        this.tableData = response.data
        updateTotal(Number(response.total))
        this.tableData.forEach(s => {
          s.gdsNames = ''
          s.goodsForm.map(m => {
            s.gdsNames += m.gdsName + ','
          })
        })
      })
      this.currentData = {}
    },
    //保存编辑 新增
    save() {
      const basic = new Promise((resolve, reject) => {
        this.$refs.basicForm.validate(valida => {
          if (valida) {
            resolve()
          } else {
            reject()
          }
        })
      })

      const send = new Promise((resolve, reject) => {
        this.$refs.sendForm.validate(valid => {
          if (valid) {
            resolve()
          } else {
            reject()
          }
        })
      })

      const accept = new Promise((resolve, reject) => {
        this.$refs.acceptForm.validate(valid => {
          if (valid) {
            resolve()
          } else {
            reject()
          }
        })
      })

      const distance = new Promise((resolve, reject) => {
        this.$refs.distanceForm.validate(valid => {
          if (valid) {
            resolve()
          } else {
            reject()
          }
        })
      })

      // const goods = new Promise((resolve, reject) => {
      //   // if(this.goodsForm.length>0){
      //   //   resolve()
      //   // }else{
      //   //   reject()
      //   // }
      //   this.$refs.goodsForm.validate(valid => {
      //     if (valid) {
      //       resolve()
      //     } else {
      //       reject()
      //     }
      //   })
      // })
      Promise.all([send, accept, distance]).then(() => {
        if (this.edit) {
          //编辑
          EditOrderPlanInfo({
            cmtContractNo: this.basicForm.cmtContractNo, //合同号

            uuid: this.basicForm.uuid,
            attCltId: this.basicForm.attCltId, //客户ID
            attCltName: this.basicForm.attCltName, //attCltName
            attCEtpId: this.basicForm.attCEtpId, //客户企业ID
            attRemark: this.basicForm.attRemark, //备注
            odcSProvince: this.sendForm.province, //发货地省
            orDeliverypointcity: this.sendForm.city, //发货地市
            adcSAddress: this.sendForm.xxdz, //发货地详细地址
            odcDProvince: this.acceptForm.province, //收货方省
            orReveivingpartytelcity: this.acceptForm.city, //收货方市
            adcDAddress: this.acceptForm.xxdz, //收货方详细地址
            attWrkdate: this.basicForm.attWrkdate, //客户要求作业时间
            attFinwrkdate: this.basicForm.attFinwrkdate, //客户要求完成时间
            adcVehicleRequirements: this.basicForm.adcVehicleRequirements, //车型

            adcCltId: this.sendForm.adcCltId, //客户ID
            adcConsigner: this.basicForm.adcConsigner, //委托人
            adcLinkperson: this.basicForm.adcLinkperson, //联系人
            adcLinkphone: this.basicForm.adcLinkphone, //联系电话
            adcTel: this.basicForm.adcTel, //手机
            adcQq: this.basicForm.adcQq, //QQ,
            adcWechat: this.basicForm.adcWechat, //微信
            adcEmail: this.basicForm.adcEmail, //EMAIL
            orReveivingparty: this.acceptForm.orReveivingparty, //收货方
            orReveivingpartycontacts: this.acceptForm.lxr, //收货方联系人
            orReveivingpartytel: this.acceptForm.lxdh, //收货方联系方式
            orShipper: this.sendForm.orShipper, //发货方

            orShippercontacts: this.sendForm.lxr, //发货方联系人
            orShippertel: this.sendForm.lxdh, //发货方联系方式
            odcSArea: this.sendForm.district, //发货地区县
            odcDArea: this.acceptForm.district, //收货地区县
            trkLong: this.basicForm.trkLong, //车长要求
            adcSX: this.sendForm.jd, //X坐标--发
            adcSY: this.sendForm.wd, //Y坐标
            adcSSwrkdate: this.sendForm.adcSSwrkdate, //装车时间段（开始）
            adcSEwrkdate: this.sendForm.adcSEwrkdate, //装车时间段（结束）
            adcDX: this.acceptForm.jd, //X坐标---收
            adcDY: this.acceptForm.wd, //Y坐标
            adcDSfinwrkdate: this.acceptForm.adcDSfinwrkdate, //卸车时间段（开始）
            adcDEfinwrkdate: this.acceptForm.adcDEfinwrkdate, //卸车时间段（结束）
            adcXcfzff: this.basicForm.adcXcfzff, //卸车费支付方（RV_DOMAIN=‘卸车费用付方’）
            adcJsfh: this.basicForm.adcJsfh, //结算方式
            adcJsfhValue: this.basicForm.adcJsfhValue, //结算类型
            adcDistanced: this.distanceForm.adcDistanced, //里程
            adcDistancedtime: this.distanceForm.adcDistancedtime, //运输时间

            //货物
            goodsForm: this.basicForm.goodsForm
            // gdsPrice: this.goodsForm[0].gdsPrice,
            // gdsName: this.goodsForm[0].gdsName,
            // gdsType: this.goodsForm[0].gdsType,
            // gdsQuantity: this.goodsForm[0].gdsQuantity,
            // gdsWeight: this.goodsForm[0].gdsWeight,
            // gdsVolumn: this.goodsForm[0].gdsVolumn,
            // gdsRemark: this.goodsForm[0].gdsRemark,
          }).then(res => {
            if (res.success === '1') {
              this.$message({
                type: 'success',
                message: '修改数据成功',
                showClose: true
              })
              this.close()
            }
          })
        } else {
          //新增
          addOrderPlanInfo({
            cmtContractNo: this.basicForm.cmtContractNo, //合同号

            attCltId: this.basicForm.attCltId, //客户ID
            attCltName: this.basicForm.attCltName, //attCltName
            attCEtpId: this.basicForm.attCEtpId, //客户企业ID
            attRemark: this.basicForm.attRemark, //备注
            odcSProvince: this.sendForm.province, //发货地省
            orDeliverypointcity: this.sendForm.city, //发货地市
            adcSAddress: this.sendForm.xxdz, //发货地详细地址
            odcDProvince: this.acceptForm.province, //收货方省
            orReveivingpartytelcity: this.acceptForm.city, //收货方市
            adcDAddress: this.acceptForm.xxdz, //收货方详细地址
            attWrkdate: this.basicForm.attWrkdate, //客户要求作业时间
            attFinwrkdate: this.basicForm.attFinwrkdate, //客户要求完成时间
            adcVehicleRequirements: this.basicForm.adcVehicleRequirements, //车型

            adcCltId: this.sendForm.adcCltId, //客户ID
            adcConsigner: this.basicForm.adcConsigner, //委托人
            adcLinkperson: this.basicForm.adcLinkperson, //联系人
            adcLinkphone: this.basicForm.adcLinkphone, //联系电话
            adcTel: this.basicForm.adcTel, //手机
            adcQq: this.basicForm.adcQq, //QQ,
            adcWechat: this.basicForm.adcWechat, //微信
            adcEmail: this.basicForm.adcEmail, //EMAIL
            orReveivingparty: this.acceptForm.orReveivingparty, //收货方
            orReveivingpartycontacts: this.acceptForm.lxr, //收货方联系人
            orReveivingpartytel: this.acceptForm.lxdh, //收货方联系方式
            orShipper: this.sendForm.orShipper, //发货方
            orShippercontacts: this.sendForm.lxr, //发货方联系人
            orShippertel: this.sendForm.lxdh, //发货方联系方式
            odcSArea: this.sendForm.district, //发货地区县
            odcDArea: this.acceptForm.district, //收货地区县
            trkLong: this.basicForm.trkLong, //车长要求
            adcSX: this.sendForm.jd, //X坐标--发
            adcSY: this.sendForm.wd, //Y坐标
            adcSSwrkdate: this.sendForm.adcSSwrkdate, //装车时间段（开始）
            adcSEwrkdate: this.sendForm.adcSEwrkdate, //装车时间段（结束）
            adcDX: this.acceptForm.jd, //X坐标---收
            adcDY: this.acceptForm.wd, //Y坐标
            adcDSfinwrkdate: this.acceptForm.adcDSfinwrkdate, //卸车时间段（开始）
            adcDEfinwrkdate: this.acceptForm.adcDEfinwrkdate, //卸车时间段（结束）
            adcXcfzff: this.basicForm.adcXcfzff, //卸车费支付方（RV_DOMAIN=‘卸车费用付方’）
            adcJsfh: this.basicForm.adcJsfh, //结算方式
            adcJsfhValue: this.basicForm.adcJsfhValue, //结算类型
            adcDistanced: this.distanceForm.adcDistanced, //里程
            adcDistancedtime: this.distanceForm.adcDistancedtime, //运输时间

            //货物
            goodsForm: this.basicForm.goodsForm
            // gdsPrice: this.goodsForm[0].gdsPrice,
            // gdsName: this.goodsForm[0].gdsName,
            // gdsType: this.goodsForm[0].gdsType,
            // gdsQuantity: this.goodsForm[0].gdsQuantity,
            // gdsWeight: this.goodsForm[0].gdsWeight,
            // gdsVolumn: this.goodsForm[0].gdsVolumn,
            // gdsRemark: this.goodsForm[0].gdsRemark,
          }).then(res => {
            if (res.success === '1') {
              this.$message({
                type: 'success',
                message: '新增数据成功',
                showClose: true
              })
              this.close()
            }
          })
        }
      })
    },
    //关闭对话框----新增编辑查看
    close() {
      this.basicForm = {}
      this.openDialog = false
      this.openDialogA = false
      this.openDialogB = false
      this.selectList = []
      this.topCurrentData = []
      this.refreshList()
    },
    //双击查看详情
    dbrowClick(row) {
      this.currentData = Object.assign({}, row)
      this.basicForm = this.currentData
      this.basicForm.cmtContractName = this.contractsCorrespondence[row.cmtContractNo]
      //收货
      this.acceptForm = {
        orReveivingparty: this.currentData.orReveivingparty,
        lxr: this.currentData.orReveivingpartycontacts,
        lxdh: this.currentData.orReveivingpartytel,
        adcDSfinwrkdate: this.currentData.adcDSfinwrkdate,
        adcDEfinwrkdate: this.currentData.adcDEfinwrkdate,
        province: this.currentData.odcDProvince,
        city: this.currentData.orReveivingpartytelcity,
        district: this.currentData.odcDArea,
        xxdz: this.currentData.adcDAddress,
        jd: this.currentData.adcDX,
        wd: this.currentData.adcDY
      }
      //发货
      this.sendForm = {
        orShipper: this.currentData.orShipper,
        lxr: this.currentData.orShippercontacts,
        lxdh: this.currentData.orShippertel,
        adcSSwrkdate: this.currentData.adcSSwrkdate,
        adcSEwrkdate: this.currentData.adcSEwrkdate,
        province: this.currentData.odcSProvince,
        city: this.currentData.orDeliverypointcity,
        district: this.currentData.odcSArea,
        xxdz: this.currentData.adcSAddress,
        jd: this.currentData.adcSX,
        wd: this.currentData.adcSY
      }
      this.distanceForm = this.currentData
      this.goodsForm[0] = this.currentData
      this.auditForm = {}
      this.check = false
      this.view = '1'
      //暂时隐藏掉双击打开弹框事件
      // this.openDialog = true
      this.edit = false
      this.see = true
      this.name = '查看订单计划'
    },
    //单击
    rowClick(row) {
      this.currentData = Object.assign({}, row)
      setTimeout(() => {
        this.getWab()
      }, 200)
    },
    getWab() {
      getWillBillListByAttCode({
        orderCode: this.currentData.attCode,
        isPlatform: 'Y'
      }).then(res => {
        this.topTableData = res.data
      })
    },
    //合同对话框选中一行
    contractRowClick(row) {
      //this.rowData=row;
      this.dealInfos.map(item => {
        if (item.cmtContractName == row.cmtContractName) {
          this.basicForm.cmtContractNo = item.cmtContractNo
          this.basicForm.cmtContractName = item.cmtContractName
          this.getDealInfo(item.cmtContractNo)
        }
      })
      this.form.cmpName = row.fltName
      this.dialogTableVisible = false
    },
    //获取动态信息
    getDynamic() {
      orderOperaInfo({
        attUuid: this.currentData.uuid
      }).then(res => {
        if (res.success === '1') {
          this.dynamicData = res.data
        }
      })
    },
    //取消发布
    cancelAudit() {
      if (Object.keys(this.currentData).length === 0) {
        this.$alert('每次只能修改一行数据，你已选择0行', '提示', {
          confirmButtonText: '确定'
        })
        return
      }

      if (this.currentData.attStatus != 'YFB') {
        this.$alert('该订单不是未发布状态，无法取消发布！', '提示', {
          confirmButtonText: '确定'
        })
        return
      }
      auditOrder({
        uuid: this.currentData.uuid,
        attStatus: 'QXFB',
        attCode: this.currentData.attCode,
        attAuditdiffering: ''
      }).then(res => {
        if (res.success === '1') {
          this.$message({
            type: 'success',
            message: '取消发布成功'
          })
          this.close()
        }
      })
    },
    // //发布
    // audit() {
    //   if (Object.keys(this.currentData).length === 0) {
    //     this.$alert('每次只能修改一个订单，你已选择0个', '提示', {
    //       confirmButtonText: '确定'
    //     })
    //     return
    //   }
    //   if (this.currentData.attStatus != 'CS') {
    //     this.$alert('该订单不是未发布状态，无法发布！', '提示', {
    //       confirmButtonText: '确定'
    //     })
    //     return
    //   }

    //   this.basicForm = this.currentData
    //   this.basicForm.cmtContractName = this.contractsCorrespondence[this.currentData.cmtContractNo]
    //   //收货
    //   this.acceptForm = {
    //     orReveivingparty: this.currentData.orReveivingparty,
    //     lxr: this.currentData.orReveivingpartycontacts,
    //     lxdh: this.currentData.orReveivingpartytel,
    //     adcDSfinwrkdate: this.currentData.adcDSfinwrkdate,
    //     adcDEfinwrkdate: this.currentData.adcDEfinwrkdate,
    //     province: this.currentData.odcDProvince,
    //     city: this.currentData.orReveivingpartytelcity,
    //     district: this.currentData.odcDArea,
    //     xxdz: this.currentData.adcDAddress,
    //     jd: this.currentData.adcDX,
    //     wd: this.currentData.adcDY
    //   }
    //   //发货
    //   this.sendForm = {
    //     orShipper: this.currentData.orShipper,
    //     lxr: this.currentData.orShippercontacts,
    //     lxdh: this.currentData.orShippertel,
    //     adcSSwrkdate: this.currentData.adcSSwrkdate,
    //     adcSEwrkdate: this.currentData.adcSEwrkdate,
    //     province: this.currentData.odcSProvince,
    //     city: this.currentData.orDeliverypointcity,
    //     district: this.currentData.odcSArea,
    //     xxdz: this.currentData.adcSAddress,
    //     jd: this.currentData.adcSX,
    //     wd: this.currentData.adcSY
    //   }
    //   this.distanceForm = this.currentData
    //   this.goodsForm[0] = this.currentData
    //   this.auditForm = {}
    //   this.check = true
    //   this.view = '1'
    //   this.openDialog = true
    //   this.edit = false
    //   this.see = true
    //   this.name = '确认发布'
    // },
    //取消订单
    delOrder() {
      if (Object.keys(this.currentData).length === 0) {
        this.$alert('每次只能修改一行数据，你已选择0行', '提示', {
          confirmButtonText: '确定'
        })
        return
      }
      // if (this.currentData.attStatus != 'YFB') {
      //   this.$alert('已发布的订单无法取消！', '提示', {
      //     confirmButtonText: '确定'
      //   })
      //   return
      // }
      this.$alert('注意：你确定取消该订单吗？取消后不可恢复！', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      }).then(() => {
        cancleOrderInfo({
          uuid: this.currentData.uuid,
          attCode: this.currentData.attCode
        }).then(res => {
          if (res.success === '1') {
            this.$message({
              type: 'success',
              message: '订单取消成功！'
            })
            this.close()
          }
        })
      })
    },
    //修改
    editOrder() {
      if (Object.keys(this.currentData).length === 0) {
        this.$alert('每次只能修改一行数据，你已选择0行', '提示', {
          confirmButtonText: '确定'
        })
        return
      }
      if (this.currentData.attStatus != 'CS') {
        this.$alert('未审核的订单才能编辑，无法编辑！', '提示', {
          confirmButtonText: '确定'
        })
        return
      }

      this.basicForm = this.currentData
      this.basicForm.cmtContractName = this.contractsCorrespondence[this.currentData.cmtContractNo]
      //收货
      this.acceptForm = {
        orReveivingparty: this.currentData.orReveivingparty || '',
        lxr: this.currentData.orReveivingpartycontacts || '',
        lxdh: this.currentData.orReveivingpartytel || '',
        adcDSfinwrkdate: this.currentData.adcDSfinwrkdate || '',
        adcDEfinwrkdate: this.currentData.adcDEfinwrkdate || '',
        province: this.currentData.odcDProvince || '',
        city: this.currentData.orReveivingpartytelcity || '',
        district: this.currentData.odcDArea || '',
        xxdz: this.currentData.adcDAddress || '',
        jd: this.currentData.adcDX || '',
        wd: this.currentData.adcDY || ''
      }
      //发货
      this.sendForm = {
        orShipper: this.currentData.orShipper || '',
        lxr: this.currentData.orShippercontacts || '',
        lxdh: this.currentData.orShippertel || '',
        adcSSwrkdate: this.currentData.adcSSwrkdate || '',
        adcSEwrkdate: this.currentData.adcSEwrkdate || '',
        province: this.currentData.odcSProvince || '',
        city: this.currentData.orDeliverypointcity || '',
        district: this.currentData.odcSArea || '',
        xxdz: this.currentData.adcSAddress || '',
        jd: this.currentData.adcSX || '',
        wd: this.currentData.adcSY || ''
      }
      this.distanceForm = this.currentData
      this.goodsForm = this.currentData
      this.openDialog = true
      this.edit = true
      this.see = false
      this.check = false
      this.view = '0'
      this.name = '编辑订单计划信息'
    },
    //findContract查询合同
    findContract() {
      this.dialogTableVisible = true
    },

    // //运单状态审核
    // audit(){
    //   if (this.topCurrentData.length == 0) {
    //     this.$alert('请选择需要审核的运单信息！', '提示', {
    //       confirmButtonText: '确定'
    //     })
    //     return
    //   }
    //    if (this.topCurrentData.wabStatus != 'DSH' ) {
    //     this.$alert('请选择派车待审核状态的运单！', '提示', {
    //       confirmButtonText: '确定'
    //     })
    //     return
    //   }
    //    this.$alert('确定审核该运单吗？', '提示', {
    //     confirmButtonText: '确定',
    //     cancelButtonText: '取消'
    //   }).then(() => {
    //       auditWayBill({
    //           uuid: this.topCurrentData.uuid,
    //         }).then(res => {
    //           if (res.success === '1') {
    //             this.$message({
    //               type: 'success',
    //               message: '运单审核成功！'
    //             })
    //             this.rowClick( this.currentData);
    //           }
    //         })
    //    })
    //   },
    //运单状态审核
    auditOrders() {
      console.log(this.selectList)
      if (this.selectList == 0) {
        this.$alert('请选择需要审核的运单信息！', '提示', {
          confirmButtonText: '确定'
        })
        return
      }
      var i = 1
      this.$alert('确定审核运单吗？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消'
      }).then(() => {
        this.selectList.forEach(element => {
          auditWayBill({
            uuid: element.uuid
          }).then(res => {
            if (res.success === '1' && i === this.selectList.length) {
              this.$message({
                type: 'success',
                message: '运单审核成功！'
              })
              this.rowClick(this.currentData)
            }
            i++
          })
        })
      })
      close()
    },
    wayTableSelectChangeHanlder(val) {
      this.selectDataList = val
    },
    // 导出运单信息
    exportWayInfo() {
      if (!this.selectDataList.length) {
        this.$message.error('至少选择一项')
        return
      }
      export_json_to_excel({
        header: this.exportExcelHeaderName,
        filename: '运单信息信息导出',
        data: this.selectDataList.map(item => this.exportExcelHeader.map(code => item[code]))
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.orderManage {
  padding: 15px 15px 12px;
  height: 100%;
  width: 100%;

  .top {
    width: 100%;
    height: 100%;

    table {
      max-width: 100%;
      font-size: 1.4rem;
      scrollcollapse: true;

      td {
        min-width: 170px;
        line-height: 3rem;
        padding-right: 3rem;
      }
    }

    table thead {
      width: calc(100% - 3em);
    }

    .form {
      height: 30px;
    }

    .btn-area {
      height: 50px;
      line-height: 50px;
      margin-top: 3px;
    }

    .btn {
      height: 50px;
      line-height: 50px;
    }

    .name {
      font-size: 16px;
      line-height: 20px;
      font-weight: 500;
      scrollcollapse: true;
    }

    /*.table {*/
    /*  flex: 1;*/
    /*}*/
  }

  .bottom {
    width: 100%;
    height: 100%;

    .name {
      font-size: 16px;
      line-height: 20px;
      font-weight: 500;
    }
  }

  .orderDynamic {
    width: 100%;
    height: 100%;

    .name {
      font-size: 16px;
      line-height: 20px;
      font-weight: 500;
    }
  }

  .concate {
    display: flex;
    justify-content: space-between;
    // padding:10px 0;
    .send {
      width: 49%;
    }

    .accept {
      width: 49%;
    }
  }

  .box {
    padding: 12px;
    position: relative;
    border: 1px solid rgb(29, 158, 233);
    border-radius: 5px;
    // height:300px;
    margin-bottom: 20px;

    .name {
      position: absolute;
      top: -20px;
      font-size: 16px;
      font-weight: 700;
      padding: 10px;
      line-height: 20px;
      background: #fff;
    }
  }
}
</style>
